package com.codexsoft.test;

import org.apache.wicket.IRequestTarget;
import org.apache.wicket.Page;
import org.apache.wicket.protocol.http.HttpSessionStore;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.protocol.http.request.WebExternalResourceRequestTarget;
import org.apache.wicket.request.RequestParameters;
import org.apache.wicket.request.target.basic.URIRequestTargetUrlCodingStrategy;
import org.apache.wicket.session.ISessionStore;

public class GaeWicketApplication extends WebApplication {
    @Override
    public Class<? extends Page> getHomePage() {
//      return HomePage.class;
        return UInfoPage.class;
    }

    @Override
    protected void init() {
        super.init();
        getResourceSettings().setResourcePollFrequency(null);

        mount(new URIRequestTargetUrlCodingStrategy("/images") {
            @Override
            public IRequestTarget decode(RequestParameters requestParameters) {
                String path = "/images/" + getURI(requestParameters);
                return new WebExternalResourceRequestTarget(path);
            }
        });
    }

    @Override
    protected ISessionStore newSessionStore() {
        return new HttpSessionStore(this);
    }
}
